unit UDevIOAddEditBase;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, UAddEditBase, cxGraphics,
  cxLookAndFeels, cxLookAndFeelPainters, Vcl.Menus, dxSkinsCore,
  dxSkinOffice2016Colorful, System.ImageList, Vcl.ImgList, cxImageList,
  Vcl.StdCtrls, cxButtons, Vcl.ExtCtrls, cxControls, cxContainer, cxEdit,
  cxDropDownEdit, cxMaskEdit, cxTextEdit, cxLabel, cxSpinEdit, Data.DB, MemDS,
  DBAccess, Uni;

type
  TfrmDevIOAddEditBase = class(TfrmAddEditBase)
    lblIOName: TcxLabel;
    edtName: TcxTextEdit;
    lblIOIP: TcxLabel;
    edtIP: TcxMaskEdit;
    lblDevCtrl: TcxLabel;
    comDevCtrl: TcxComboBox;
    lblPort: TcxLabel;
    edtPort: TcxSpinEdit;
    qryTmp: TUniQuery;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }

    procedure InitDevCtrlData;
  public
    { Public declarations }
  end;

var
  frmDevIOAddEditBase: TfrmDevIOAddEditBase;

implementation

{$R *.dfm}

procedure TfrmDevIOAddEditBase.FormCreate(Sender: TObject);
begin
  inherited;

  InitDevCtrlData;
end;

procedure TfrmDevIOAddEditBase.InitDevCtrlData;
begin
  comDevCtrl.Properties.Items.Clear;

  with qryTmp do
  begin
    Close;
    SQL.Text := 'select * from DevCtrlData order by CtrlID';
    Open;

    while not Eof do
    begin
      comDevCtrl.Properties.Items.AddObject(FieldByName('CtrlName').AsString, TObject(FieldByName('CtrlID').AsInteger));

      Next;
    end;
  end;
end;

end.
